<!DOCTYPE html>
<html>
<head>
    <title>商品列表</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="../../../css/bootstrap.min.css">
    <link rel="stylesheet" href="../../../css/font-awesome.min.css">
    <link rel="stylesheet" href="../../../plugins/jqgrid/ui.jqgrid-bootstrap.css">
    <link rel="stylesheet" href="../../../plugins/ztree/css/metroStyle/metroStyle.css">
    <link rel="stylesheet" href="../../../css/main.css">
    <link rel="stylesheet" type="text/css"
          href="../../../plugins/webuploader/css/webuploader.css">
    <link rel="stylesheet" type="text/css"
          href="../../../plugins/webuploader/css/auto.css">
    <script src="../../../libs/jquery.min.js"></script>
    <script src="../../../plugins/layer/layer.js"></script>
    <script src="../../../libs/bootstrap.min.js"></script>
    <script src="../../../libs/vue.min.js"></script>
    <script src="../../../libs/vee-validate.min.js"></script>
    <script src="../../../libs/zh_CN.js"></script>
    <script src="../../../libs/accounting.min.js"></script>
    <script src="../../../plugins/jqgrid/grid.locale-cn.js"></script>
    <script src="../../../plugins/jqgrid/jquery.jqGrid.min.js"></script>
    <script src="../../../plugins/ztree/jquery.ztree.all.min.js"></script>
    <script src="../../../js/common.js"></script>
    <script src="../../../libs/ajaxupload.js"></script>
    <script type="text/javascript"
            src="../../../plugins/webuploader/js/webuploader_back.js"></script>
    <script type="text/javascript"
            src="../../../plugins/webuploader/js/auto_back.js"></script>
    <script>
        Vue.use(VeeValidate, {
            locale: 'zh_CN',
        });

    </script>
</head>
<body>
<div id="dcapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <div class="form-group col-sm-2">
                <input type="text" class="form-control" v-model="q.key" @keyup.enter="query" placeholder="商品名称">
            </div>
            <a class="btn btn-default" @click="query">查询</a>
            <a v-if="hasPermission('sys:user:save')" class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
            <a v-if="hasPermission('sys:user:update')" class="btn btn-primary" @click="update"><i
                    class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
            <a class="btn btn-primary" onclick="edit()"><i
                    class="fa fa-pencil-square-o"></i>&nbsp;测试</a>
            <a v-if="hasPermission('sys:user:delete')" class="btn btn-primary" @click="del"><i
                    class="fa fa-trash-o"></i>&nbsp;删除</a>
            <a v-if="hasPermission('sys:user:delete')" class="btn btn-primary" @click="up"><i
                    class="fa fa-trash-o"></i>&nbsp;上架</a>
            <a v-if="hasPermission('sys:user:delete')" class="btn btn-primary" @click="down"><i
                    class="fa fa-trash-o"></i>&nbsp;下架</a>
            <a class="btn btn-danger" style="float:right;" href="goodsTypeList.html">商品类型列表</a>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
            <div>
                <div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">商品名称</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="goods.name" v-validate="'required|max:10'"
                                   name="商品名称" placeholder="商品名称"/>
                            <span v-show="errors.has('商品名称')" class="help">{{ errors.first('商品名称') }}</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">选择分类</div>
                        <div class="col-sm-10">
                            <select class="form-control" v-model="goods.goodsType" name="商品分类"
                                    v-validate="'required'">
                                <option v-for="option in options" :value="option.id">
                                    {{ option.name }}
                                </option>
                            </select>
                            <span v-show="errors.has('商品分类')" class="help">{{ errors.first('商品分类') }}</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">商品价格</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="goods.sellPrice"
                                   v-validate="'required|between:0,99999|regex:^[0-9]+(.[0-9]{2})?$'" placeholder="商品价格"
                                   name="商品价格"/>
                            <span v-show="errors.has('商品价格')" class="help">{{ errors.first('商品价格') }}</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">初始库存</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="goods.initQty" placeholder="初始库存"
                                   name="初始库存" v-validate="'required|between:0,9999'"/>
                            <span v-show="errors.has('初始库存')" class="help">{{ errors.first('初始库存') }}</span>
                        </div>
                    </div>
                    <div class="form-group" v-show="!isAdd">
                        <div class="col-sm-2 control-label">剩余库存</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="goods.remainQty" placeholder="剩余库存"
                                   name="剩余库存" v-validate="'required|between:0,9999'"/>
                            <span v-show="errors.has('剩余库存')" class="help">{{ errors.first('剩余库存') }}</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">每日库存</div>
                        <div class="col-sm-10">
                            <select v-model="goods.dailyStock" class="form-control" name="每日库存" v-validate="'required'">
                                <option value="1">开启</option>
                                <option value="0">关闭</option>
                            </select>
                            <span v-show="errors.has('每日库存')" class="help">{{ errors.first('每日库存') }}</span>
                        </div>
                    </div>
                        <div class="form-group">

                            <div class="col-sm-2 control-label">商品照片</div>

                            <div class="wu-example uploader col-sm-10" id="upload_store">
                                <!--<%&#45;&#45; 文件队列区域 &#45;&#45;%>-->
                                <div class="queueList">
                                    <!--<%&#45;&#45; 拖拽区域 &#45;&#45;%>-->
                                    <div class="placeholder dndArea">
                                        <div class="webuploader-container filePicker">
                                            <div class="webuploader-pick">选择图片</div>
                                        </div>
                                        <!-- <p>您还可以将照片拖到这里或使用截屏工具后激活本窗口并粘贴</p> -->
                                    </div>
                                    <!--<%&#45;&#45; 文件列表 &#45;&#45;%>-->
                                    <ul class="filelist"></ul>
                                </div>
                                <!--<%&#45;&#45; 状态按钮区域 &#45;&#45;%>-->
                                <div class="statusBar" style="display: none;">
                                    <div class="progress" style="display: none;">
                                        <span class="text">0%</span> <span class="percentage"
                                                                           style="width: 0%;"></span>
                                    </div>
                                    <!--<%&#45;&#45;<div class="info">共0张（0B），已上传0张</div>&#45;&#45;%>-->
                                    <div class="btns">
                                        <div class="webuploader-container filePicker2">
                                            <div class="webuploader-pick">继续添加</div>
                                        </div>
                                        <!-- <div class="uploadBtn state-pedding">开始上传</div> -->
                                    </div>
                                </div>
                            </div>
                        </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-2 control-label"></div>
                    <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定" />
                    &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
                </div>
            </div>
        </form>
    </div>
</div>

<script src="../../../js/modules/merchant/goods/goodsList.js"></script>
</body>
</html>